<template>
  <div class="address"></div>
</template>

<script>
import { getAddressDate, addAddressDate, getRegionDate } from "@/utils/http";
export default {
  // eslint-disable-next-line vue/no-unused-components
  // components: { getAddressDate ,addAddressDate,getRegionDate},
  created() {
    this.getshi();
    this.addAddress()
  },
  methods: {
    // 获取省市区
    getshi() {
      getRegionDate({ parentId: 1 }).then((res) => {
        // console.log(res);
      });
    },
    // 添加收货地址
    addAddress() {
      let date = {
        name: "小李",
        mobile: "10000000000",
        address: "北京昌平",
        province_id: "0",
        city_id: "0",
        district_id: "0",
        is_default: "false",
      };
      addAddressDate(date).then((res) => {
        console.log(res);
      });
    },
    // 请求收货地址
    getAddress() {
      getAddressDate().then((res) => {
        console.log(res);
        if (res.errno == 401) {
          this.$toast.fail("请先登录");
          this.$router.push("/my");
        } else {
          console.log(res);
        }
      });
    },
  },
};
</script>

<style>
</style>